package com.prs.crm.action.oa;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.struts.BaseAction;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;

import com.prs.crm.domain.oa.FileSendCollect;
import com.prs.crm.domain.oa.NoticeCollect;
import com.prs.crm.service.oa.FileSendCollectService;

public class FileSendCollectAction extends BaseAction{
	private static final long serialVersionUID = 1L;
	private PaginationSupport pagination;
	private Integer[] ids;
	private FileSendCollect fileSendCollect;
	private FileSendCollectService fileSendCollectService;
	
	@Action("listFileSendCollect")
	public String listFileSendCollect(){
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(FileSendCollect.class);
		pagination = this.getPaginationHelper().prepare(pagination);
		this.setPagination(this.getFileSendCollectService().listByPage(criteria,pagination));
		return SUCCESS;
	}
	
	@Action(value = "removeFileSendCollect", results = {
			@Result(name = "success", type = "redirect", location = "listFileSendCollect"),
			@Result(name = "error", type = "chain", location = "listFileSendCollect") })
	public String removeFileSendCollect(){
		if(ids == null){
			this.addActionError("请选择要删除的文件收藏");
			return ERROR;
		}
		this.getFileSendCollectService().batchRemove(ids);
		return SUCCESS;
	}
	
	@Action("viewFileSendCollect")
	public String viewFileSendCollect(){
		return SUCCESS;
	}
	
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	public Integer[] getIds() {
		return ids;
	}
	public void setIds(Integer[] ids) {
		this.ids = ids;
	}
	public FileSendCollect getFileSendCollect() {
		return fileSendCollect;
	}
	public void setFileSendCollect(FileSendCollect fileSendCollect) {
		this.fileSendCollect = fileSendCollect;
	}
	public FileSendCollectService getFileSendCollectService() {
		return fileSendCollectService;
	}
	public void setFileSendCollectService(
			FileSendCollectService fileSendCollectService) {
		this.fileSendCollectService = fileSendCollectService;
	}
}
